import request from '@/utils/request'

// 查询所有用户
export function getUserList() {
  return request({
    url: '/clientuser/user/list',
    method: 'get'
  })
}

// 按条件和分页查询用户
export function getOptionsList(query) {
  return request({
    url: '/clientuser/user/optionsList',
    method: 'get',
    params: query
  })
}

// 按照id删除用户
export function deleteUserById(id) {
  return request({
    url: '/clientuser/user/deleteUserById/' + id,
    method: 'delete'
  })
}

// 按照id切换冻结状态
export function freezeStatusById(id, status) {
  return request({
    url: '/clientuser/user/freezeStatusById/' + id + '/' + status,
    method: 'put'
  })
}

// 按照id查询用户
export function getUserById(id) {
  return request({
    url: '/clientuser/user/getUserById/' + id,
    method: 'get'
  })
}

// 添加用户
export function insertUser(user) {
  return request({
    url: '/clientuser/user/insertUser/',
    method: 'post',
    params: user
  })
}

// 上传用户名
export function userIdUpload(id) {
  return request({
    url: `/oss/setUserId/${id}`,
    method: 'get'
  })
}

// 添加用户
export function updateUser(user) {
  return request({
    url: '/clientuser/user/updateUser/',
    method: 'put',
    params: user
  })
}

// 按照id 或 手机号查询用户
export function getUserListByQuery(query) {
  return request({
    url: '/clientuser/user/getUserListByQuery/' + query,
    method: 'get'
  })
}

// 按照id 或 手机号查询用户
export function getAddressByUserId(userId) {
  return request({
    url: '/clientuser/address/getAddressByUserId/' + userId,
    method: 'get'
  })
}
